package com.rc.saas.mini.service.ugs;

import com.rc.saas.mini.mapper.ugs.TenantUgsSuperLevelPriceMapper;
import com.rc.saas.mini.model.ugs.TenantUgsSuperLevelPrice;
import com.rc.saas.mini.model.ugs.TenantUgsSuperLevelPriceExample;
import com.rc.saas.mini.vo.ugs.TenantUgsSuperLevelPriceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TenantUgsSuperLevelPriceServiceImpl implements TenantUgsSuperLevelPriceService {

    @Autowired
    private TenantUgsSuperLevelPriceMapper tenantUgsSuperLevelPriceMapper;

    @Override
    public TenantUgsSuperLevelPriceMapper getMapper() {
        return tenantUgsSuperLevelPriceMapper;
    }

    @Override
    public List<TenantUgsSuperLevelPriceVo> listByTenantCode(String tenantCode) {
        return tenantUgsSuperLevelPriceMapper.listByTenantCode(tenantCode);
    }

    @Override
    public TenantUgsSuperLevelPrice selectBySuperCardType(String superCardType, String tenantCode) {
        TenantUgsSuperLevelPriceExample example = new TenantUgsSuperLevelPriceExample();
        example.createCriteria().andSuperCardTypeEqualTo(superCardType).andTenantCodeEqualTo(tenantCode).andStatusEqualTo("0");
        List<TenantUgsSuperLevelPrice> tenantUgsSuperLevelPrices = tenantUgsSuperLevelPriceMapper.selectByExample(example);
        if (tenantUgsSuperLevelPrices != null && tenantUgsSuperLevelPrices.size() > 0) {
            return tenantUgsSuperLevelPrices.get(0);
        }
        return null;
    }
}
